/**
 * 
 */
package com.taobao.snowsnow.hibernate.service.impl;

import java.util.List;

import com.taobao.snowsnow.hibernate.dao.ProductCollectDao;
import com.taobao.snowsnow.hibernate.pojo.ProductCollect;
import com.taobao.snowsnow.hibernate.service.ProductCollectService;

/**
 * @author Tux
 *
 * 创建时间: 2011-4-29 上午09:55:17
 */
public class ProductCollectServiceImpl extends BaseServiceImpl implements ProductCollectService {
	private ProductCollectDao pdao;
	
	public List<ProductCollect> findAll() {
		try {
			return pdao.findAll();
		} catch(Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public ProductCollect findById(int id) {
		try {
			return pdao.findById(id);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findById(int id)");
		}
		return null;
	}
	
	public List<ProductCollect> findByName(String name) {
		try {
			return pdao.findByName(name);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findByName(String name)");
		}
		return null;
	}

	public long getTotal()  {
		try {
			return pdao.getTotal();
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at getTotal()");
		}
		return -1;
	}

	public List<ProductCollect> paging(int page, int limit)  {
		try {
			return pdao.paging(page, limit);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at paging(int page, int limit)");
		}
		return null;
	}

	public void setPdao(ProductCollectDao cdao) {
		this.pdao = cdao;
	}

	public ProductCollectDao getPdao() {
		return pdao;
	}

	@Override
	public ProductCollect getFirstObject() {
		try {
			return pdao.getFirstObject();
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("ProductCollect getFirstObject()");
		}
		return null;
	}

	@Override
	public ProductCollect getLastObject() {
		try {
			return pdao.getLastObject();
		} catch(Exception e) {
			e.printStackTrace();
			System.out.println("ProductCollect getLastObject()");
		}
		return null;
	}

	/* (non-Javadoc)
	 * @see com.taobao.snowsnow.hibernate.service.ProductCollectService#findByNumIID(java.lang.Long)
	 */
	@Override
	public ProductCollect findByNumIID(Long numIId) {
		try {
			return pdao.findByNumIID(numIId);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("ProductCollect findByNumIID()");
		}
		return null;
	}
}
